<?php
namespace Managers;
use \Site\Photos as PhotosEntity;

class Photos extends BaseManager{
    public function getAll($housing){
        return $this->getEntityManager()
                ->createQueryBuilder()
                ->select('n')
                ->from('Site\Photos', 'n')
                ->where('n.housing = :housing')
                ->orderBy('n.id', '')
                ->getQuery()
                ->setParameters(array('housing'=>$housing))
                ->getResult();
    }

    public function getOne($id){
        return $this->getEntityManager()
                ->createQueryBuilder()
                ->select('n')
                ->from('Site\Photos', 'n')
                ->where('n.id = :id')
                ->getQuery()
                ->setParameters(array('id'=>$id))
                ->getSingleResult();
    }

}
